<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>预警规则管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		function dispatching(id){
			$.ajax({
				type:"post",
				url:"${ctx}/guobo/rw/dispatching?id="+id,
				async:true,
				success: function(data){
					if(data.code == 0){
						alert(data.msg);
					}else{
						alert(data.msg);
					}
				},
				error: function(err){
					alert(err);
				}
			});
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/guobo/warningRole/">预警规则列表</a></li>
		<shiro:hasPermission name="guobo:warningRole:edit"><li><a href="${ctx}/guobo/warningRole/form">预警规则添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="warningRole" action="${ctx}/guobo/warningRole/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>规则名称：</label>
				<form:input path="name" htmlEscape="false" maxlength="64" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>规则名称</th>
				<!-- <th>展馆</th>
				<th>位置</th> -->
				<th>读写器</th>
				<th>状态</th>
				<th>更新日期</th>
				<th>备注</th>
				<shiro:hasPermission name="guobo:warningRole:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="warningRole">
			<tr>
				<td><a href="${ctx}/guobo/warningRole/form?id=${warningRole.id}">
					${warningRole.name}
				</a></td>
				<%-- <td>
					${warningRole.rw.location.exhHall.name}
				</td>
				<td>
					${warningRole.rw.location.name}
				</td> --%>
				<td>
					${warningRole.rwNames}
				</td>
				<td>
					
					<c:if test="${warningRole.status eq '00'}">
						未布防
					</c:if>					
					<c:if test="${warningRole.status eq '01'}">
						已布防
					</c:if>
				</td>
				<td>
					<fmt:formatDate value="${warningRole.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${warningRole.remarks}
				</td>
				<shiro:hasPermission name="guobo:warningRole:edit"><td>
					<input id="btnDispatching" class="btn btn-inverse" type="button" value="布  控" onclick="dispatching('${warningRole.id}');"/>&nbsp;
    				<a href="${ctx}/guobo/warningRole/form?id=${warningRole.id}">修改</a>
					<a href="${ctx}/guobo/warningRole/delete?id=${warningRole.id}" onclick="return confirmx('确认要删除该预警规则吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>